const App = getApp()
// icon图标
import iconImg from '../../utils/iconImg.js';
Page({
  /**
   * 页面的初始数据
   */
  data: {
    iconImg:iconImg.iconImg(),//获取图标
    bid:0,
    role_id:0,
    cardList1:[
      {
        title:"管理员设置",
        data:
        [
          {url:'manage/recharge/record',img:'icon1',name:'充值记录'},
          {url:'manage/car/car',img:'icon2',name:'车牌管理'},
          {url:'shop/license/license',img:'icon3',name:'营业执照'},
          {url:'manage/image/image',img:'icon4',name:'门店图片'}, 
          {url:'shop/param/param',img:'icon5',name:'参数配置'},
          {url:'shop/net/card',img:'icon6',name:'网卡配置'},
          {url:'data/chart',img:'icon7',name:'数据中心'},
          {url:'manage/service/record',img:'icon8',name:'服务费'},
          {url:'manage/car/wash',img:'icon26',name:'洗车耗材'},
          {url:'manage/hexiao/record',img:'icon24',name:'核销记录'},
        ],
      },{
        title:"账号管理",
        data:
        [
          {url:'shop/account/sub',img:'icon9',name:'子账号'},
          {url:'shop/account/password',img:'icon27',name:'修改密码'},
          {url:'App.loginout',img:'icon10',name:'退出登录'}
        ],
      }
    ],
    cardList:[
      {
        title:"门店管理",
        data:
        [
          {url:'shop/list/list',img:'icon11',name:'门店列表'},
          {url:'shop/time/time',img:'icon12',name:'营业时间'},
          {url:'shop/tel/tel',img:'icon13',name:'客服电话'},
          {url:'shop/image/image',img:'icon4',name:'门店图片'}, 
          {url:'shop/mini/mini',img:'icon14',name:'小程序公告'},
          {url:'shop/led/led',img:'icon15',name:'LED大屏'},
          {url:'shop/horn/horn',img:'icon16',name:'智慧终端'},
          {url:'shop/open/door',img:'icon2',name:'开门洗车'},
          {url:'shop/maintain/maintain',img:'icon17',name:'工位维护'},
          {url:'shop/black/black',img:'icon18',name:'黑名单用户'},
          {url:'shop/qrcode/qrcode',img:'icon19',name:'出入场码'},
					{url:'shop/cabinet/cabinet',img:'icon1',name:'智能毛巾柜'},
					{url:'shop/auto/auto',img:'icon28',name:'全自动洗车'},
        ],
      },
      {
        title:"经营管理",
        data:
        [
          {url:'shop/recharge/set',img:'icon20',name:'充值选项'},
          {url:'shop/standard/standard',img:'icon21',name:'收费标准'},
          {url:'shop/recharge/record',img:'icon1',name:'充值记录'},
          {url:'shop/recharge/first',img:'icon22',name:'首冲优惠'}, 
          {url:'shop/recharge/free',img:'icon23',name:'首冲送券'},
          {url:'manage/hexiao/record',img:'icon24',name:'核销记录'},
          {url:'data/chart',img:'icon7',name:'数据中心'}
        ],
      },{
        title:"总部运营",
        data:
        [
          {url:'shop/handbook/handbook',img:'icon25',name:'店主手册'},
          {url:'shop/haocai/wash',img:'icon26',name:'洗车耗材'},
          {url:'shop/net/card',img:'icon6',name:'网卡查询'}
        ],
      },{
        title:"账号管理",
        data:
        [
          {url:'shop/account/sub',img:'icon9',name:'子账号'},
          {url:'shop/account/password',img:'icon27',name:'修改密码'},
          {url:'App.loginout',img:'icon10',name:'退出登录'}
        ],
      }
    ] ,
    cardList2:[
     {
        title:"账号管理",
        data:
        [
          {url:'App.loginout',img:'icon10',name:'退出登录'}
        ],
      }
    ],

  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {

  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    //检测是否登录
    App.checkIsLogin()
    console.log('bid',App.get_b_id())
    this.setData({
      bid : App.get_b_id(),
      role_id:wx.getStorageSync('role_id')
    })
  },
  /**
   * 页面跳转
   */
  jumpUrl:function(e){
    
    let url = e.currentTarget.dataset.url
    if(url == 'shop/recharge/first'){
      wx.showToast({
        title: '暂未开通该功能',
        icon:'none'
      })
      return false;
    }
    if(url == 'App.loginout'){
      // 退出登录
      App.loginout()
      return false;
    }else{
      wx.navigateTo({
        url: '/pages/'+url,
      })
    }
  },
  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onRefresh(){
    //在当前页面显示导航条加载动画
    wx.showNavigationBarLoading(); 
    //显示 loading 提示框。需主动调用 wx.hideLoading 才能关闭提示框
    that.get_shops();
  },
  onPullDownRefresh: function () {
    //调用刷新时将执行的方法
    this.onRefresh();
    setTimeout(function () {
      // 不加这个方法真机下拉会一直处于刷新状态，无法复位
      wx.stopPullDownRefresh()
    }, 1000)
  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  onRefresh(){
    //在当前页面显示导航条加载动画
    wx.showNavigationBarLoading(); 
    //显示 loading 提示框。需主动调用 wx.hideLoading 才能关闭提示框
  },
  onPullDownRefresh: function () {
    //调用刷新时将执行的方法
    this.onRefresh();
    setTimeout(function () {
      // 不加这个方法真机下拉会一直处于刷新状态，无法复位
      wx.stopPullDownRefresh()
    }, 1000)
  }
  
})
 